{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px">
                            <input type="text" id="user_name" class="layui-input search" name="user_name" value="" placeholder="案例名字"/>
                        </div>
                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px">
                            <input type="text" id="user_name2" class="layui-input search" name="user_name2" value="" placeholder="收藏用户名字|电话"/>
                        </div>
                        <div class="layui-input-inline" style="margin-top: 5px">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>

                <!--操作框开始-->
                <!--<div class="col-sm-12">-->
                    <!--<div class="input-group" >-->
                        <!--<button class="btn btn-primary" type="button" onclick="wk.layer_show('新建', '{:url('newAdd')}')">-->
                            <!--<i class="fa fa-plus"></i> 添加-->
                        <!--</button>-->
                        <!--<button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">-->
                            <!--<i class="fa fa-wrench"></i> 批量操作 <span class="caret"></span>-->
                        <!--</button>-->
                        <!--<ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="ppll1">批量冻结</a></li>-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="ppll2">批量解冻</a></li>-->
                        <!--</ul>-->
                    <!--</div>-->
                <!--</div>-->
                <!--操作框结束-->
            </div>
            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="testReload"></table>
                    <!--图片显示模板-->
                    <script type="text/html" id="imgTpl">
                        <img src="{{d.user_image}}" class="table-img" onerror="this.src='/static/admin/images/head_default.gif'"/>
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        {{# if(d.like_jilu_time) { }}
                        <a href="javascript:;" onclick="wk.layer_show('沟通记录', '{:url('caseOrder')}?case_id={{d.case_id}}&user_id={{d.user_id}}')" class="btn btn-primary btn-xs m-r-xs" title="沟通记录">沟通记录</a>
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Casejilu/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 300]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
//                {type: 'checkbox', fixed: 'left'}
                  {type:'numbers', width: 70, title: '序号'}
                , {field: 'case_name', width: '', title: '案例名字', align: 'center'}
                , {field: 'user_username', width: '', title: '收藏用户', align: 'center'}
                , {field: 'user_phone', width: '', title: '用户电话', align: 'center'}
                , {field: 'user_image', width: '100', title: '用户头像', align: 'center',templet: '#imgTpl'}
                , {field: 'like_jilu_time', width: '180', title: '最后沟通时间', align: 'center'}
                , {field: 'like_time', width: '', title: '收藏时间', align: 'center'}
                , {fixed: 'right', width:'120', title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.table-img').viewer({
                    url: 'data-original',
                });
            }
        });
        //监听状态开关操作
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['case_id'])
            });
            return ids;
        };
    });
</script>
</body>
</html>